import request from '@/utils/request'
import qs from 'qs'
// 左侧全部列表  一级+二级
export function listDepAll() {
  return request({
    url: '/department/allList',
    method: 'get',
  })
}

// 点击站点  获取站点下的部门 获取站点下全部 分类 列表  二级
export function listDep(query) {
  return request({
    url: '/department/list',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'get',
    params: query
  })
}


// 获取子部门列表
export function subList(parentId) {
  return request({
    url: '/department/subList',
    headers: { 'content-type': 'application/x-www-form-urlencoded', showLoading: false },
    method: 'get',
    params: parentId

  })
}



// 新增投稿部门
export function departmentAdd(data) {
  return request({
    url: '/department/add',
    method: 'post',
    data: data
  })
}

// 修改投稿部门
export function departmentEdit(data) {
  return request({
    url: '/department/edit',
    method: 'post',
    data: data
  })
}

// 删除投稿部门
export function departmentRemove() {
  return request({
    url: '/department/remove',
    method: 'post',
    data: data
  })
}



// 查询部门详细
export function getDepInfo(depId) {
  return request({
    url: '/department/' + depId,
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'get'
  })
}

// 删除投稿部门
export function delDepLeft(data) {
  return request({
    url: '/department/remove',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'POST',
    data: qs.stringify(data)
  })
}

//删除投稿部门目录
export function delDepRight(depIds) {
  return request({
    url: `/department/${depIds}`,
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'post',
  })
}

